package com.comac.print.component.app.domain.gateway.enums;

import lombok.Getter;
import lombok.Setter;

import java.util.Arrays;

/**
 * @Description 工序状态枚举
 * @Author lihao
 * @Date 2021/9/2 15:35
 */
public enum FoWorkStatusEnum {
    TODO("00","待接收"),
    REVIEWED("01","接收"),
    BEGIN("02","开工"),
    DONE("03","完工"),
    REVOCATION("04","撤销"),
    DISABLE("05","禁用");


    @Getter
    @Setter
    private String code;
    @Getter
    @Setter
    private String description;

    FoWorkStatusEnum(String code, String description){
        this.code = code;
        this.description= description;
    }


    /**
     * 通过code获取枚举值
     * @param code
     * @return
     */
    public static FoWorkStatusEnum getFoWorkStatusEnumByCode(String code){
        return Arrays.stream(FoWorkStatusEnum.values())
                .filter(foStatusEnum -> foStatusEnum.getCode().equals(code))
                .findFirst().orElse(null);
    }
}
